package naito_rescue.communication.channel;

import java.util.*;

import sample.*;
import rescuecore2.messages.*;
import rescuecore2.worldmodel.*;
import rescuecore2.Constants;
import rescuecore2.config.*;
import rescuecore2.standard.components.*;
import rescuecore2.standard.entities.*;
import rescuecore2.standard.messages.*;
import rescuecore2.misc.geometry.*;

import naito_rescue.*;
import naito_rescue.agent.*;
import naito_rescue.object.*;
import naito_rescue.message.*;
import naito_rescue.message.manager.*;

public class VoiceChannel extends AbstractChannel
{
	private int maxMessageCount;
	private int hearableRange;
	private Map<Integer, Integer> remaindBandwidth;
	
	public VoiceChannel(int num, int bw, int count, int range, double inputFailureProb, double outputDropoutProb)
	{
		super(num, bw, inputFailureProb, outputDropoutProb);
		this.maxMessageCount = count;
		this.hearableRange = range;
		this.remaindBandwidth = new HashMap<Integer, Integer>();
	}
	
	public int getMaxMessageCount(){
		return this.maxMessageCount;
	}
	public int getHearableRange(){
		return this.hearableRange;
	}
	public void setUsedBandWidth(int used, int time){
		if(remaindBandwidth.get(time) == null){
			remaindBandwidth.put(time, this.bandwidth);
		}
		int remaind = remaindBandwidth.get(time) - used;
		remaindBandwidth.put(time, remaind);
	}
	public int getRemaindBandwidth(int time){
		if(remaindBandwidth.get(time) == null){
			remaindBandwidth.put(time, this.bandwidth);
		}
		return remaindBandwidth.get(time);
	}
}
